//! 展示所有字符集类别的示例

use unichar::{Unichar, Config, Style};

fn main() {
    println!("=== Unichar 所有字符集类别展示 ===\n");

    let mut unichar = Unichar::new();
    unichar.set_config(Config::new().with_style(Style::Icon));

    // 1. 基础字符集
    println!("1. 📋 基础字符集:");
    let basic_chars = ["success", "error", "warning", "info", "star", "heart", "arrow_right", "play", "lock"];
    for char_name in basic_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 2. 程序员字符集
    println!("2. 💻 程序员字符集:");
    let programmer_chars = ["code", "bug", "git", "function", "database", "api", "docker", "test", "deploy"];
    for char_name in programmer_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 3. 数学字符集
    println!("3. 🔢 数学字符集:");
    let math_chars = ["plus", "minus", "multiply", "divide", "equals", "infinity", "pi", "sigma", "integral"];
    for char_name in math_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 4. 科学字符集
    println!("4. 🔬 科学字符集:");
    let science_chars = ["atom", "dna", "microscope", "planet", "moon", "sun", "telescope", "beaker", "energy"];
    for char_name in science_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 5. 货币字符集
    println!("5. 💰 货币字符集:");
    let currency_chars = ["dollar", "euro", "yen", "bitcoin", "money", "bank", "stock", "investment", "profit"];
    for char_name in currency_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 6. 天气字符集
    println!("6. 🌤️ 天气字符集:");
    let weather_chars = ["sun", "moon", "cloud", "rain", "snow", "lightning", "wind", "fog", "rainbow"];
    for char_name in weather_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 7. 音乐字符集
    println!("7. 🎵 音乐字符集:");
    let music_chars = ["music", "piano", "guitar", "microphone", "headphones", "play", "pause", "volume_high", "concert"];
    for char_name in music_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 8. 游戏字符集
    println!("8. 🎮 游戏字符集:");
    let gaming_chars = ["gamepad", "player", "enemy", "boss", "level", "health", "attack", "achievement", "multiplayer"];
    for char_name in gaming_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 9. 社交字符集
    println!("9. 👥 社交字符集:");
    let social_chars = ["like", "share", "comment", "friend", "family", "chat", "email", "notification", "privacy"];
    for char_name in social_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 10. 食物字符集
    println!("10. 🍎 食物字符集:");
    let food_chars = ["apple", "banana", "bread", "coffee", "cake", "pizza", "burger", "sushi", "healthy"];
    for char_name in food_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 11. 交通字符集
    println!("11. 🚗 交通字符集:");
    let transport_chars = ["car", "bus", "train", "airplane", "ship", "bike", "traffic_light", "gas_station", "parking"];
    for char_name in transport_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 12. 办公字符集
    println!("12. 🏢 办公字符集:");
    let office_chars = ["computer", "desk", "meeting", "document", "email", "calendar", "business", "project", "presentation"];
    for char_name in office_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 13. 医疗字符集
    println!("13. ⚕️ 医疗字符集:");
    let medical_chars = ["doctor", "hospital", "medicine", "stethoscope", "healthy", "sick", "emergency", "vaccine", "therapy"];
    for char_name in medical_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 14. 宗教字符集
    println!("14. 🙏 宗教字符集:");
    let religious_chars = ["cross", "islam", "judaism", "buddhism", "hinduism", "church", "mosque", "temple", "prayer"];
    for char_name in religious_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 15. 文化字符集
    println!("15. 🎨 文化字符集:");
    let cultural_chars = ["art", "museum", "theater", "festival", "literature", "dance", "tradition", "heritage", "fashion"];
    for char_name in cultural_chars {
        if let Some(char) = unichar.get(char_name) {
            println!("   {}: {}", char_name, char);
        }
    }
    println!();

    // 显示统计信息
    println!("📊 字符集统计信息:");
    let stats = unichar.get_stats();
    println!("   总字符数: {}", stats.total_characters);
    println!("   各样式支持数量:");
    for (style, count) in stats.style_counts {
        println!("     {:?}: {}", style, count);
    }
    println!();

    // 演示样式切换
    println!("🎨 样式切换演示 (以 'success' 为例):");
    let styles = [Style::Simple, Style::Icon, Style::Bold, Style::Color];
    for style in styles {
        unichar.set_config(Config::new().with_style(style.clone()));
        if let Some(char) = unichar.get("success") {
            println!("   {:?}: {}", style, char);
        }
    }
    println!();

    // 演示字符串格式化
    println!("📝 字符串格式化演示:");
    unichar.set_config(Config::new().with_style(Style::Icon));
    let templates = [
        "程序员: {code} 调试: {bug} 部署: {deploy}",
        "数学: {plus} {equals} 科学: {atom} {dna}",
        "天气: {sun} {rain} {snow} 音乐: {piano} {guitar}",
        "交通: {car} {plane} {train} 食物: {pizza} {coffee}",
    ];
    
    for template in templates {
        let result = unichar.format(template);
        println!("   {}", result);
    }
    println!();

    println!("🎉 所有字符集类别展示完成！");
}
